
/*
	useGlobal
	false(default) - 开启一个独立的上下文环境并在该环境中运行所有代码，这些代码不可访问当运行环境开启之后开发者在全局作用域中定义的变量值或对象
	true - 在当前上下文运行环境中运行所有代码，可访问...之后…

*/
var repl = require('repl');
function testFunc(obj){
	msg = 'message';
}


/*
repl.start({
	useGlobal: true
});
testFunc();

F:\GitCK\xx-fontendTest\test-nodejs\myApp\repl>node 3_start.js
> msg
'message'
>
*/




/*
repl.start({
	useGlobal: false
});
testFunc();

> msg
ReferenceError: msg is not defined
    at repl:1:2
    at REPLServer.self.eval (repl.js:112:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
    at ReadStream.onkeypress (readline.js:99:10)
    at ReadStream.EventEmitter.emit (events.js:98:17)
    at emitKey (readline.js:1095:12)
*/


/*
testFunc();
repl.start({
	useGlobal: false
});

F:\GitCK\xx-fontendTest\test-nodejs\myApp\repl>node 3_start.js
> msg
'message'

*/